import 'package:flutter/material.dart';

class ListViewWidgetPage extends StatefulWidget {
  @override
  _ListViewWidgetPageState createState() => new _ListViewWidgetPageState();
}

class _ListViewWidgetPageState extends State<ListViewWidgetPage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(
          centerTitle: true,
          title: new Text('ListView'),
        ),
        ///ListView.separated可以生成列表项之间的分割器，它比
        ///ListView.builder多了一个separatorBuilder参数，该参数是一个分割器生成器
        body: ListView.separated(
            itemCount: 100,
            separatorBuilder:(BuildContext ctx,int index){
              return Divider(color: Colors.grey,height: 0.5,);
            } ,
            itemBuilder: (BuildContext ctx, int index) {
              return ListTile(
                title: Text('标题$index'),
                subtitle: Text('详情内容$index'),
              );
            }));
  }
}
